#ifndef SICBOGAME_H
#define SICBOGAME_H

#include "DiceGame.h"
#include "SicBoSharedDefs.h"

class CrapsConnection;

/**************************************************************************************************************
* This class implements all of the logic for handling SicBo specific messages, generating the dice rolls,
* and calculating the wins or losses on the roll based on what bets the player made.  The outcome from each
* game is passed to an instance of the SicBoSQL class to be written to the database.
* kharmon.  06-16-06.  #3077.  Added for SicBo.
***************************************************************************************************************/
class SicBoGame : public DiceGame
{
public:

    SicBoGame(CrapsConnection *pConnection);

    virtual ~SicBoGame();

    // the CrapsConnection class calls this whenever a message packet comes in from the network
    virtual bool8 handleMessage(unsigned char *pucMsgBuf, int32 nMsgLen);

    // this is called when the player initial connects to this server, to alert the client about min/max stuff.
    virtual void send(bool8 bSaved);

    // does nothing, sicbo has no saved games
    virtual void save();

protected:

    // called when a "roll" message has arrived
    bool8 processRollMessage(uint8 *pucMsgBuf, int32 nMsgLen);

    // evaluates the result of the roll to see how much was won or lost.
    int32 calcPayout(uint8 ucDie1, uint8 ucDie2, uint8 ucDie3, int32 nNumBets, int32& nBalAdj, int32& nTotalPayout);

    
    class Exception 
    {
    
    };    

protected:

    SicBoBet m_arrBets[SicBoBet::MAX_BET_TYPE];     // holds the bet values from a roll message

    int32 m_nBetMax[SicBoBet::MAX_BET_TYPE];        // holds the Maximum Bet for each bet type

    CrapsConnection *m_pConn;                       // we need to keep a pointer to the connection

    uint8 m_ucPayTable;     // this game supports 3 paytables...which is active?

    int32 m_nBalance;       // the last known balance.

};

#endif